package com.nanshututeng.DynamicSQL;


import org.apache.ibatis.jdbc.SQL;

import java.util.Map;




/**
 * Created by Administrator on 2018-09-20.
 */
public class UserDynaProvider {
    public String selectuserWithParam(Map<String,Object>param) {
        return new SQL() {
            {

               SELECT("uid,rtrim(userid)userid,rtrim(phone)phone,rtrim(idcard)idcard,rtrim(username)username,(case sex when '1'then '男' when'2' then'女' else '未知'end)sex,rtrim(password)password,birthday,FirstLandtime,LastLandtime,IsLand,IsRegester,rtrim(jtzz)jtzz,rtrim(subscribe)subscribe,city,province,county,rtrim(headimgurl)headimgurl,subscribe_time,remark,groupid,tagid_list,isaddbz,isfriendbz");
                FROM("gyb_user");
                if (param.get("userid") != null) {
                    WHERE("userid=#{userid}");
                }
                if (param.get("phone") != null) {
                    WHERE("phone=#{phone}");
                }

            }
        }.toString();
    }



}